package com.sskj.mine;

import com.lzy.okrx2.adapter.FlowableBody;
import com.sskj.common.base.HttpData;
import com.sskj.lib.bean.PageBean;
import com.sskj.lib.http.JsonConverter;
import com.sskj.mine.bean.NodeBean;
import com.sskj.mine.presenter.BasePresenter;
import com.sskj.mine.SuperNodeActivity;

import java.util.ArrayList;
import java.util.List;

import io.reactivex.Flowable;
import okhttp3.Response;


/**
 * @author Hey
 * Create at  2019/05/10
 */
class SuperNodePresenter extends BasePresenter<SuperNodeActivity> {

    public Flowable<List<NodeBean>> getData(String page ,String size){
         return httpService.getNode(page, size)
                .converter(new JsonConverter<HttpData<PageBean<NodeBean>>>() {
                })
                .adapt(new FlowableBody<>())
                .map(pageBeanHttpData -> pageBeanHttpData.getData().getList())
                .onErrorReturnItem(new ArrayList<>());
    }

}
